package com.server.common.logistics.jc.track;

import com.google.gson.annotations.SerializedName;
import com.server.common.logistics.response.LogisticsResponse;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.util.ObjectUtils;

import java.util.List;

@NoArgsConstructor
@Getter
@Setter
public class JCGetTrackResponse extends LogisticsResponse {


    @SerializedName("ack")
    private String ack;
    @SerializedName("data")
    private List<Data> data;

    @Override
    public Boolean responseOk() {
        return "true".equals(ack);
    }

    @Override
    public Boolean dataEmpty() {
        return ObjectUtils.isEmpty(data);
    }

    @NoArgsConstructor
    @Getter
    @Setter
    public static class Data {
        @SerializedName("consigneeCountry")
        private String consigneeCountry;
        @SerializedName("productKindName")
        private String productKindName;
        @SerializedName("referenceNumber")
        private String referenceNumber;
        @SerializedName("trackContent")
        private String trackContent;
        @SerializedName("trackDate")
        private String trackDate;
        @SerializedName("trackLocation")
        private String trackLocation;
        @SerializedName("trackSignperson")
        private String trackSignperson;
        @SerializedName("trackingNumber")
        private String trackingNumber;
        @SerializedName("trackDetails")
        private List<TrackDetails> trackDetails;

        @NoArgsConstructor
        @Getter
        @Setter
        public static class TrackDetails {
            @SerializedName("track_content")
            private String trackContent;
            @SerializedName("track_date")
            private String trackDate;
            @SerializedName("track_location")
            private String trackLocation;
            @SerializedName("track_signdate")
            private String trackSigndate;
            @SerializedName("track_signperson")
            private String trackSignperson;
        }
    }
}
